package com.example.plcopne.adapter;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.plcopne.LogBean;
import com.example.plcopne.R;

import java.util.List;

/**
 * 描述：控制台输出适配器
 * 作者: 钮家齐
 * 时间: 2020/5/23 17:18
 */
public class LogListAdapter extends BaseQuickAdapter<LogBean, BaseViewHolder> {

    public LogListAdapter(List list) {
        super(R.layout.item_layout, list);
    }

    @Override
    protected void convert(BaseViewHolder helper, LogBean item) {

        helper.setText(R.id.textView, item.log);
        if(item.type==1){
            //todo 发送
            helper.setTextColor(R.id.textView, Color.BLACK);
        }else{
            //todo 接收
            helper.setTextColor(R.id.textView, Color.RED);
        }

    }

}